<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSocialiteUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('socialite_users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('用户id');
            $table->string('uid', 100)->default('')->comment('第三方用户id');
            $table->string('open_id', 100)->default('')->comment('第三方用户open id');
            $table->string('name', 100)->default('')->comment('姓名');
            $table->string('user_name', 100)->default('')->comment('用户名');
            $table->string('nick_name', 50)->default('')->comment('用户昵称');
            $table->string('avatar')->default('')->comment('头像');
            $table->tinyInteger('device_type')->default(0)->comment('设备类型 : 1.android, 2.ios, 3.其他');
            $table->string('params', 1000)->default('')->comment('数据打包:json根式');
            $table->timestamps();

            $table->unique(['uid']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('socialite_users');
    }
}
